package com.itheima.DateTimeDemo;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;

/**
 * @author zhangbaiyan
 * @date 2024-08-22 18:59
 * @description:
 * @version:
 */
public class test2 {
    /*
    static Instant now()    获取当前时间的Instant对象(标准时间)
    static Instant ofXxxx(long epochMilli) 根据(秒/毫秒/纳秒)获取Instant对象
    ZonedDateTime atZone()    指定时区
    Boolean isXxx(Instant otherInstant) 判断系列方法
    Instant minusXxx(long amount, TemporalUnit unit)    减去时间
    Instant plusXxx(long amount, TemporalUnit unit)    加上时间
     */

    public static void main(String[] args) {
        //1.获取当前时间的Instant对象(标准时间)
        Instant instant = Instant.now();
        System.out.println(instant);

        //2.根据(秒/毫秒/纳秒)获取Instant对象
        Instant instant1 = Instant.ofEpochSecond(0L);
        System.out.println(instant1);

        Instant instant2 = Instant.ofEpochSecond(0L, 0L);

        //3.指定时区
        ZonedDateTime time = Instant.now().atZone(ZoneId.of("Asia/Shanghai"));
        System.out.println(time);

    }
}
